/**
 * Author: Lily Jiang
 * Create Time: 2019/12/24
 * Description:
 */

import React from "react";
import './Index.scss'
import PropTypes from 'prop-types';

class AppHeader extends React.Component {
    constructor(props) {
        super(props);
        this.state = {

        };
    }

    goBack = () => {
        window.history.back()
    }

    render() {
        return (
            <div className={"comp_app-header " + (this.props.showBottomLine ? 'comp_app-header-line' : '')}>
                <div className="back-btn" onClick={this.goBack}>
                    <img src={require("../../assets/images/common/zuojiantou.png")} alt=""/>
                </div>
                <div className="title df1">{this.props.title || ''}</div>
                <div className="action" onClick={this.props.action}>{this.props.actionText || ''}</div>
            </div>
        );
    }
}

AppHeader.defaultProps = {
    action: null,
    showBottomLine: true
};

AppHeader.propTypes = {
    title: PropTypes.string,
    action: PropTypes.func,
    actionText: PropTypes.string,
    showBottomLine: PropTypes.bool,
};

export default AppHeader